/* eslint-disable */
import axios from './axios'
import qs from 'qs'
import { baseUrl } from '@/config/config'
// 获取类别列表 /bdc/api/app/roles
export const getRoles = (params) => {
        return new Promise((resolve, reject) => {
            axios({
                url: baseUrl + '/bdc/api/app/roles',
                method: 'get',
                params
            }).then(res => {
                resolve(res.data)
            }).catch(error => {
                reject(error)
            })
        })
    }
    // 获取角色身份类型 /bdc/api/app/roles/userRoleIdentityList
export const getRoleType = (params) => {
        return new Promise((resolve, reject) => {
            axios({
                url: baseUrl + '/bdc/api/app/roles/userRoleIdentityList',
                method: 'get',
                params
            }).then(res => {
                resolve(res.data)
            }).catch(error => {
                reject(error)
            })
        })
    }
    // 菜单权限 /bdc/api/app/roles/menusTree
export const getMenu = (params) => {
        return new Promise((resolve, reject) => {
            axios({
                url: baseUrl + '/bdc/api/app/roles/menusTree',
                method: 'get',
                params
            }).then(res => {
                resolve(res.data)
            }).catch(error => {
                reject(error)
            })
        })
    }
    // 添加角色 /bdc/api/app/roles
export const addRole = (params) => {
        return new Promise((resolve, reject) => {
            axios({
                url: baseUrl + '/bdc/api/app/roles',
                method: 'post',
                data: params
            }).then(res => {
                resolve(res.data)
            }).catch(error => {
                reject(error)
            })
        })
    }
    // 编辑角色 /bdc/api/app/roles
export const editRole = (params) => {
        return new Promise((resolve, reject) => {
            axios({
                url: baseUrl + '/bdc/api/app/roles',
                method: 'put',
                data: params
            }).then(res => {
                resolve(res.data)
            }).catch(error => {
                reject(error)
            })
        })
    }
    // 删除角色 /bdc/api/app/roles
export const delRole = (params) => {
    return new Promise((resolve, reject) => {
        axios({
            url: baseUrl + '/bdc/api/app/roles',
            method: 'delete',
            params
        }).then(res => {
            resolve(res.data)
        }).catch(error => {
            reject(error)
        })
    })
}